<?php

namespace App\Http\Requests;

use App\Models\Order;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class OrderRequest extends BaseRequest
{
    public function routeRules(): array
    {
        return [
            'api.order.checkout|api.order.store' => [
                'id' => 'required|integer',
                'type' => ['required', 'integer', Rule::in(array_keys(Order::$goodsTypeText))]
            ],
        ];
    }

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return $this->getRouteRules();
    }
}
